-- Damocles
local Damocles = fk.CreateSkill {
    name = "mcdh_Damocles",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

Damocles:addEffect('active',{
    prompt = "#mcdh_Damocles-active",
    can_use = function(self, player)
        return player:getMark("mcdh_ammo") >= 4
    end,
    target_filter = function(self, player,to_select, selected)
        if #selected == 0 then
            local target = to_select
            return target ~= nil and target:getMark("@mcdh_Damocles") == 0
        end
        return false
    end,
    target_num = 1,
    on_use = function(self, room, effect)
        local target = effect.tos[1]
        lib.mcdh_ammo(effect.from, -4)
        room:addPlayerMark(target, "@mcdh_Damocles", 1)
    end
})

Fk:loadTranslationTable {
    ["mcdh_Damocles"] = "机瞄",
    [":mcdh_Damocles"] = "『Damocles』<br>装填技(4)。出牌阶段限一次，你可以消耗4枚弹药，令一名角色获得标记「锁定」。",
    ["#mcdh_Damocles-active"] = "机瞄：消耗4枚弹药，令一名角色获得标记「锁定」",
    ["@mcdh_Damocles"] = "锁定"
}

return Damocles